package net.cocotea.sqltoy.lambda.factory.condition;

import net.cocotea.sqltoy.lambda.func.SFunction;

import java.io.Serializable;
import java.util.Collection;
import java.util.function.Consumer;

public interface ICondition<T> extends Serializable {
    /**
     * 嵌套条件
     *
     * @param action {@link ICondition}
     * @return {@link ICondition}
     */
    ICondition<T> nested(Consumer<ICondition<T>> action);

    ICondition<T> eq(SFunction<T, ?> fn, Object value);

    ICondition<T> neq(SFunction<T, ?> fn, Object value);

    ICondition<T> gt(SFunction<T, ?> fn, Object value);

    ICondition<T> gte(SFunction<T, ?> fn, Object value);

    ICondition<T> lt(SFunction<T, ?> fn, Object value);

    ICondition<T> lte(SFunction<T, ?> fn, Object value);

    ICondition<T> like(SFunction<T, ?> fn, String value);

    ICondition<T> notLike(SFunction<T, ?> fn, String value);

    ICondition<T> leftLike(SFunction<T, ?> fn, String value);

    ICondition<T> rightLike(SFunction<T, ?> fn, String value);

    ICondition<T> in(SFunction<T, ?> fn, Collection<?> values);

    ICondition<T> notIn(SFunction<T, ?> fn, Collection<?> values);

    ICondition<T> between(SFunction<T, ?> fn, Object value1, Object value2);

    ICondition<T> or();

    ICondition<T> and();

    ICondition<T> where();
}
